package com.v5ba.server.service.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.v5ba.server.service.ILogService;
import com.v5ba.server.service.IUserService;
import com.v5ba.server.service.IWebService;
import org.springframework.stereotype.Service;

/**
 * @author yiren
 * @date 2018/6/17
 */
@Service
public class WebServiceImpl implements IWebService {

    @Reference(version = "1.0.0", group = "server-a", interfaceClass = IUserService.class)
    private IUserService userService;

    @Reference(version = "1.0.0", group = "server-b", interfaceClass = ILogService.class)
    private ILogService logService;

    @Override
    public void addError() {
        String name = "张三";
        String phone = "18611912657";
        userService.addUser(name, phone);
        int num = 1 / 0;
        logService.addLog("新增用户", "姓名：" + name + "，手机：" + phone);
    }

    @Override
    public void add() {
        String name = "张三";
        String phone = "18611912657";
        userService.addUser(name, phone);
        logService.addLog("新增用户", "姓名：" + name + "，手机：" + phone);
    }
}
